<ResourceDictionary
    xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
    xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml" xmlns:Controls="clr-namespace:WindowManager.Controls"
    xmlns:Forms="clr-namespace:System.Windows.Forms;assembly=System.Windows.Forms"
    xmlns:Microsoft_Windows_Themes="clr-namespace:Microsoft.Windows.Themes;assembly=PresentationFramework.Aero"
    xmlns:xctk="http://schemas.xceed.com/wpf/xaml/toolkit"
    xmlns:Xceed_Wpf_Toolkit_Chromes="clr-namespace:Xceed.Wpf.Toolkit.Chromes;assembly=WPFToolkit.Extended"
    xmlns:Xceed_Wpf_Toolkit_Core_Converters="clr-namespace:Xceed.Wpf.Toolkit.Core.Converters;assembly=WPFToolkit.Extended"
    xmlns:Converters="clr-namespace:WindowManager.Converters"
    xmlns:MarkupExtensions="clr-namespace:WindowManager.MarkupExtensions">

    <Converters:MultiValueEnumConverter x:Key="multiValueEnumConverter"/>

    <Style TargetType="{x:Type Controls:HotKeyControl}">
        <Setter Property="Template">
            <Setter.Value>
                <ControlTemplate TargetType="{x:Type Controls:HotKeyControl}">
                    <Border Background="{TemplateBinding Background}"
                            BorderBrush="{TemplateBinding BorderBrush}"
                            BorderThickness="{TemplateBinding BorderThickness}">
                        <Grid>
                            <Grid.ColumnDefinitions>
                                <ColumnDefinition Width="Auto"/>
                                <ColumnDefinition Width="Auto"/>
                                <ColumnDefinition Width="Auto"/>
                                <ColumnDefinition Width="Auto"/>
                                <ColumnDefinition Width="Auto"/>
                            </Grid.ColumnDefinitions>

                            <ToggleButton Grid.Column="0" Content="Ctrl" IsChecked="{Binding HotKey.ModifierKeys, Converter={StaticResource multiValueEnumConverter}, ConverterParameter={x:Static ModifierKeys.Control}, RelativeSource={RelativeSource TemplatedParent}}" />
                            <ToggleButton Grid.Column="1" Content="Shift" IsChecked="{Binding HotKey.ModifierKeys, Converter={StaticResource multiValueEnumConverter}, ConverterParameter={x:Static ModifierKeys.Shift}, RelativeSource={RelativeSource TemplatedParent}}" />
                            <ToggleButton Grid.Column="2" Content="Alt" IsChecked="{Binding HotKey.ModifierKeys, Converter={StaticResource multiValueEnumConverter}, ConverterParameter={x:Static ModifierKeys.Alt}, RelativeSource={RelativeSource TemplatedParent}}"/>
                            <ToggleButton Grid.Column="3" Content="Win" IsChecked="{Binding HotKey.ModifierKeys, Converter={StaticResource multiValueEnumConverter}, ConverterParameter={x:Static ModifierKeys.Windows}, RelativeSource={RelativeSource TemplatedParent}}" />
                            <ComboBox Grid.Column="4" ItemsSource="{MarkupExtensions:EnumValuesExtension EnumType=Forms:Keys, SortByName=True}" SelectedItem="{Binding HotKey.Key, RelativeSource={RelativeSource TemplatedParent}}"/>

                        </Grid>

                    </Border>
                </ControlTemplate>
            </Setter.Value>
        </Setter>
    </Style>

    <Style x:Key="ColorPickerStyle1" TargetType="{x:Type xctk:ColorPicker}">
        <Setter Property="Background" Value="White"/>
        <Setter Property="BorderBrush">
            <Setter.Value>
                <LinearGradientBrush EndPoint="0.5,1" StartPoint="0.5,0">
                    <GradientStop Color="#FFA3AEB9" Offset="0"/>
                    <GradientStop Color="#FF8399A9" Offset="0.375"/>
                    <GradientStop Color="#FF718597" Offset="0.375"/>
                    <GradientStop Color="#FF617584" Offset="1"/>
                </LinearGradientBrush>
            </Setter.Value>
        </Setter>
        <Setter Property="BorderThickness" Value="1,1,0,1"/>
        <Setter Property="ButtonStyle">
            <Setter.Value>
                <Style TargetType="{x:Type ToggleButton}">
                    <Setter Property="Template">
                        <Setter.Value>
                            <ControlTemplate TargetType="{x:Type ToggleButton}">
                                <Grid SnapsToDevicePixels="True">
                                    <Grid>
                                        <Grid.ColumnDefinitions>
                                            <ColumnDefinition Width="*"/>
                                            <ColumnDefinition Width="Auto"/>
                                        </Grid.ColumnDefinitions>
                                        <Border BorderBrush="{TemplateBinding BorderBrush}" BorderThickness="{TemplateBinding BorderThickness}" Background="{TemplateBinding Background}" Padding="{TemplateBinding Padding}" SnapsToDevicePixels="True">
                                            <ContentPresenter ContentTemplate="{TemplateBinding ContentTemplate}" Content="{TemplateBinding Content}" HorizontalAlignment="{TemplateBinding HorizontalContentAlignment}" VerticalAlignment="{TemplateBinding VerticalContentAlignment}"/>
                                        </Border>
                                        <Xceed_Wpf_Toolkit_Chromes:ButtonChrome x:Name="ToggleButtonChrome" Grid.Column="1" CornerRadius="0,2.75,2.75,0" InnerCornerRadius="0,1.75,1.75,0" RenderMouseOver="{TemplateBinding IsMouseOver}" RenderPressed="{TemplateBinding IsPressed}" RenderChecked="{Binding IsOpen, RelativeSource={RelativeSource FindAncestor, AncestorLevel=1, AncestorType={x:Type xctk:ColorPicker}}}" RenderEnabled="{Binding IsEnabled, RelativeSource={RelativeSource FindAncestor, AncestorLevel=1, AncestorType={x:Type xctk:ColorPicker}}}">
                                            <Grid x:Name="arrowGlyph" Grid.Column="1" IsHitTestVisible="False" Margin="5">
                                                <Path Data="M0,1C0,1 0,0 0,0 0,0 3,0 3,0 3,0 3,1 3,1 3,1 4,1 4,1 4,1 4,0 4,0 4,0 7,0 7,0 7,0 7,1 7,1 7,1 6,1 6,1 6,1 6,2 6,2 6,2 5,2 5,2 5,2 5,3 5,3 5,3 4,3 4,3 4,3 4,4 4,4 4,4 3,4 3,4 3,4 3,3 3,3 3,3 2,3 2,3 2,3 2,2 2,2 2,2 1,2 1,2 1,2 1,1 1,1 1,1 0,1 0,1z" Fill="Black" Height="4" Width="7"/>
                                            </Grid>
                                        </Xceed_Wpf_Toolkit_Chromes:ButtonChrome>
                                    </Grid>
                                </Grid>
                            </ControlTemplate>
                        </Setter.Value>
                    </Setter>
                </Style>
            </Setter.Value>
        </Setter>
        <Setter Property="Focusable" Value="False"/>
        <Setter Property="HorizontalContentAlignment" Value="Stretch"/>
        <Setter Property="VerticalContentAlignment" Value="Center"/>
        <Setter Property="Template">
            <Setter.Value>
                <ControlTemplate TargetType="{x:Type xctk:ColorPicker}">
                    <Grid>
                        <ToggleButton x:Name="PART_ColorPickerToggleButton" BorderBrush="{TemplateBinding BorderBrush}" BorderThickness="{TemplateBinding BorderThickness}" Background="{TemplateBinding Background}" HorizontalContentAlignment="{TemplateBinding HorizontalContentAlignment}" IsTabStop="True" IsChecked="{Binding IsOpen, Mode=TwoWay, RelativeSource={RelativeSource TemplatedParent}}" MinHeight="22" Padding="{TemplateBinding Padding}" Style="{TemplateBinding ButtonStyle}" VerticalContentAlignment="{TemplateBinding VerticalContentAlignment}">
                            <ToggleButton.IsHitTestVisible>
                                <Binding Path="IsOpen" RelativeSource="{RelativeSource TemplatedParent}">
                                    <Binding.Converter>
                                        <Xceed_Wpf_Toolkit_Core_Converters:InverseBoolConverter/>
                                    </Binding.Converter>
                                </Binding>
                            </ToggleButton.IsHitTestVisible>
                            <Grid Margin="2">
                                <Border x:Name="ColorOnly">
                                    <Border.Style>
                                        <Style TargetType="{x:Type Border}">
                                            <Setter Property="Background">
                                                <Setter.Value>
                                                    <Binding Path="SelectedColor" RelativeSource="{RelativeSource TemplatedParent}">
                                                        <Binding.Converter>
                                                            <Xceed_Wpf_Toolkit_Core_Converters:ColorToSolidColorBrushConverter/>
                                                        </Binding.Converter>
                                                    </Binding>
                                                </Setter.Value>
                                            </Setter>
                                            <Style.Triggers>
                                                <DataTrigger Binding="{Binding SelectedColor, RelativeSource={RelativeSource TemplatedParent}}" Value="Transparent">
                                                    <Setter Property="Background">
                                                        <Setter.Value>
                                                            <DrawingBrush TileMode="Tile" Viewport="0,0,10,10" ViewportUnits="Absolute">
                                                                <DrawingBrush.Drawing>
                                                                    <DrawingGroup>
                                                                        <GeometryDrawing Brush="White">
                                                                            <GeometryDrawing.Geometry>
                                                                                <RectangleGeometry Rect="0,0,100,100"/>
                                                                            </GeometryDrawing.Geometry>
                                                                        </GeometryDrawing>
                                                                        <GeometryDrawing Brush="LightGray">
                                                                            <GeometryDrawing.Geometry>
                                                                                <GeometryGroup>
                                                                                    <RectangleGeometry Rect="0,0,50,50"/>
                                                                                    <RectangleGeometry Rect="50,50,50,50"/>
                                                                                </GeometryGroup>
                                                                            </GeometryDrawing.Geometry>
                                                                        </GeometryDrawing>
                                                                    </DrawingGroup>
                                                                </DrawingBrush.Drawing>
                                                            </DrawingBrush>
                                                        </Setter.Value>
                                                    </Setter>
                                                </DataTrigger>
                                            </Style.Triggers>
                                        </Style>
                                    </Border.Style>
                                </Border>
                                <Border x:Name="ColorAndName" Background="White" Visibility="Hidden">
                                    <StackPanel Orientation="Horizontal">
                                        <Border BorderBrush="#FFC9CACA" BorderThickness="1" HorizontalAlignment="Left" Margin="2,1,4,1" Width="20">
                                            <Border.Style>
                                                <Style TargetType="{x:Type Border}">
                                                    <Setter Property="Background">
                                                        <Setter.Value>
                                                            <Binding Path="SelectedColor" RelativeSource="{RelativeSource TemplatedParent}">
                                                                <Binding.Converter>
                                                                    <Xceed_Wpf_Toolkit_Core_Converters:ColorToSolidColorBrushConverter/>
                                                                </Binding.Converter>
                                                            </Binding>
                                                        </Setter.Value>
                                                    </Setter>
                                                    <Style.Triggers>
                                                        <DataTrigger Binding="{Binding SelectedColor, RelativeSource={RelativeSource TemplatedParent}}" Value="Transparent">
                                                            <Setter Property="Background">
                                                                <Setter.Value>
                                                                    <DrawingBrush TileMode="Tile" Viewport="0,0,10,10" ViewportUnits="Absolute">
                                                                        <DrawingBrush.Drawing>
                                                                            <DrawingGroup>
                                                                                <GeometryDrawing Brush="White">
                                                                                    <GeometryDrawing.Geometry>
                                                                                        <RectangleGeometry Rect="0,0,100,100"/>
                                                                                    </GeometryDrawing.Geometry>
                                                                                </GeometryDrawing>
                                                                                <GeometryDrawing Brush="LightGray">
                                                                                    <GeometryDrawing.Geometry>
                                                                                        <GeometryGroup>
                                                                                            <RectangleGeometry Rect="0,0,50,50"/>
                                                                                            <RectangleGeometry Rect="50,50,50,50"/>
                                                                                        </GeometryGroup>
                                                                                    </GeometryDrawing.Geometry>
                                                                                </GeometryDrawing>
                                                                            </DrawingGroup>
                                                                        </DrawingBrush.Drawing>
                                                                    </DrawingBrush>
                                                                </Setter.Value>
                                                            </Setter>
                                                        </DataTrigger>
                                                    </Style.Triggers>
                                                </Style>
                                            </Border.Style>
                                        </Border>
                                        <TextBlock Text="{Binding SelectedColorText, RelativeSource={RelativeSource TemplatedParent}}" VerticalAlignment="Center"/>
                                    </StackPanel>
                                </Border>
                            </Grid>
                        </ToggleButton>
                        <Popup x:Name="PART_ColorPickerPalettePopup" AllowsTransparency="True" Focusable="False" HorizontalOffset="1" IsOpen="{Binding IsChecked, ElementName=PART_ColorPickerToggleButton}" PopupAnimation="Slide" StaysOpen="False" VerticalOffset="1" VerticalAlignment="Bottom">
                            <Border BorderThickness="1" Padding="3">
                                <Border.BorderBrush>
                                    <LinearGradientBrush EndPoint="0.5,1" StartPoint="0.5,0">
                                        <GradientStop Color="#FFA3AEB9" Offset="0"/>
                                        <GradientStop Color="#FF8399A9" Offset="0.375"/>
                                        <GradientStop Color="#FF718597" Offset="0.375"/>
                                        <GradientStop Color="#FF617584" Offset="1"/>
                                    </LinearGradientBrush>
                                </Border.BorderBrush>
                                <Border.Background>
                                    <LinearGradientBrush EndPoint="0,1" StartPoint="0,0">
                                        <GradientStop Color="White" Offset="0"/>
                                        <GradientStop Color="#FFE8EBED" Offset="1"/>
                                    </LinearGradientBrush>
                                </Border.Background>
                                <Grid>
                                    <Grid.RowDefinitions>
                                        <RowDefinition Height="Auto"/>
                                        <RowDefinition/>
                                        <RowDefinition Height="Auto"/>
                                    </Grid.RowDefinitions>
                                    <Grid x:Name="_colorCanvasHost" Visibility="Visible">
                                        <xctk:ColorCanvas x:Name="PART_ColorCanvas" BorderThickness="0" Background="Transparent" SelectedColor="{Binding SelectedColor, RelativeSource={RelativeSource TemplatedParent}}" Style="{DynamicResource ColorCanvasStyle1}"/>
                                    </Grid>
                                </Grid>
                            </Border>
                        </Popup>
                    </Grid>
                    <ControlTemplate.Triggers>
                        <Trigger Property="DisplayColorAndName" Value="True">
                            <Setter Property="Visibility" TargetName="ColorOnly" Value="Collapsed"/>
                            <Setter Property="Visibility" TargetName="ColorAndName" Value="Visible"/>
                        </Trigger>
                    </ControlTemplate.Triggers>
                </ControlTemplate>
            </Setter.Value>
        </Setter>
    </Style>
    <Style x:Key="ColorCanvasStyle1" TargetType="{x:Type xctk:ColorCanvas}">
        <Setter Property="Background">
            <Setter.Value>
                <LinearGradientBrush EndPoint="0,1" StartPoint="0,0">
                    <GradientStop Color="White" Offset="0"/>
                    <GradientStop Color="#FFE8EBED" Offset="1"/>
                </LinearGradientBrush>
            </Setter.Value>
        </Setter>
        <Setter Property="BorderBrush">
            <Setter.Value>
                <LinearGradientBrush EndPoint="0.5,1" StartPoint="0.5,0">
                    <GradientStop Color="#FFA3AEB9" Offset="0"/>
                    <GradientStop Color="#FF8399A9" Offset="0.375"/>
                    <GradientStop Color="#FF718597" Offset="0.375"/>
                    <GradientStop Color="#FF617584" Offset="1"/>
                </LinearGradientBrush>
            </Setter.Value>
        </Setter>
        <Setter Property="BorderThickness" Value="1"/>
        <Setter Property="Template">
            <Setter.Value>
                <ControlTemplate TargetType="{x:Type xctk:ColorCanvas}">
                    <Border BorderBrush="{TemplateBinding BorderBrush}" BorderThickness="{TemplateBinding BorderThickness}" Background="{TemplateBinding Background}" Padding="3">
                        <Grid Margin="2">
                            <Grid.ColumnDefinitions>
                                <ColumnDefinition/>
                                <ColumnDefinition/>
                            </Grid.ColumnDefinitions>
                            <Grid>
                                <Grid.ColumnDefinitions>
                                    <ColumnDefinition Width="200"/>
                                    <ColumnDefinition Width="Auto"/>
                                </Grid.ColumnDefinitions>
                                <Grid.RowDefinitions>
                                    <RowDefinition Height="Auto"/>
                                    <RowDefinition Height="Auto"/>
                                </Grid.RowDefinitions>
                                <Border BorderBrush="DarkGray" BorderThickness="1" ClipToBounds="True">
                                    <Border.Background>
                                        <DrawingBrush TileMode="Tile" Viewport="0,0,10,10" ViewportUnits="Absolute">
                                            <DrawingBrush.Drawing>
                                                <DrawingGroup>
                                                    <GeometryDrawing Brush="White">
                                                        <GeometryDrawing.Geometry>
                                                            <RectangleGeometry Rect="0,0,100,100"/>
                                                        </GeometryDrawing.Geometry>
                                                    </GeometryDrawing>
                                                    <GeometryDrawing Brush="LightGray">
                                                        <GeometryDrawing.Geometry>
                                                            <GeometryGroup>
                                                                <RectangleGeometry Rect="0,0,50,50"/>
                                                                <RectangleGeometry Rect="50,50,50,50"/>
                                                            </GeometryGroup>
                                                        </GeometryDrawing.Geometry>
                                                    </GeometryDrawing>
                                                </DrawingGroup>
                                            </DrawingBrush.Drawing>
                                        </DrawingBrush>
                                    </Border.Background>
                                    <Canvas x:Name="PART_ColorShadingCanvas" HorizontalAlignment="Left" Height="100" VerticalAlignment="Top" Width="200">
                                        <Rectangle x:Name="ColorShadingRectangle" Height="{Binding Height, ElementName=PART_ColorShadingCanvas}" Width="{Binding Width, ElementName=PART_ColorShadingCanvas}">
                                            <Rectangle.Fill>
                                                <Binding ElementName="PART_SpectrumSlider" Path="SelectedColor">
                                                    <Binding.Converter>
                                                        <Xceed_Wpf_Toolkit_Core_Converters:ColorToSolidColorBrushConverter/>
                                                    </Binding.Converter>
                                                </Binding>
                                            </Rectangle.Fill>
                                        </Rectangle>
                                        <Rectangle x:Name="WhiteGradient" Height="{Binding Height, ElementName=PART_ColorShadingCanvas}" Width="{Binding Width, ElementName=PART_ColorShadingCanvas}">
                                            <Rectangle.Fill>
                                                <LinearGradientBrush EndPoint="1,0" StartPoint="0,0">
                                                    <GradientStop Color="White" Offset="0"/>
                                                    <GradientStop Color="Transparent" Offset="1"/>
                                                </LinearGradientBrush>
                                            </Rectangle.Fill>
                                        </Rectangle>
                                        <Rectangle x:Name="BlackGradient" Height="{Binding Height, ElementName=PART_ColorShadingCanvas}" Width="{Binding Width, ElementName=PART_ColorShadingCanvas}">
                                            <Rectangle.Fill>
                                                <LinearGradientBrush EndPoint="0,0" StartPoint="0,1">
                                                    <GradientStop Color="Black" Offset="0"/>
                                                    <GradientStop Color="#00000000" Offset="1"/>
                                                </LinearGradientBrush>
                                            </Rectangle.Fill>
                                        </Rectangle>
                                        <Canvas x:Name="PART_ColorShadeSelector" Height="10" IsHitTestVisible="False" Width="10">
                                            <Ellipse Height="10" IsHitTestVisible="False" Stroke="White" StrokeThickness="3" Width="10"/>
                                            <Ellipse Height="10" IsHitTestVisible="False" Stroke="Black" StrokeThickness="1" Width="10"/>
                                        </Canvas>
                                    </Canvas>
                                </Border>
                                <Border Margin="0,5,0,0" Grid.Row="1">
                                    <Grid>
                                        <Grid.ColumnDefinitions>
                                            <ColumnDefinition Width="*"/>
                                            <ColumnDefinition Width="*"/>
                                        </Grid.ColumnDefinitions>
                                        <Border BorderBrush="#FFC9CACA" BorderThickness="1" Height="22" Margin="2,0">
                                            <Border.Background>
                                                <DrawingBrush TileMode="Tile" Viewport="0,0,10,10" ViewportUnits="Absolute">
                                                    <DrawingBrush.Drawing>
                                                        <DrawingGroup>
                                                            <GeometryDrawing Brush="White">
                                                                <GeometryDrawing.Geometry>
                                                                    <RectangleGeometry Rect="0,0,100,100"/>
                                                                </GeometryDrawing.Geometry>
                                                            </GeometryDrawing>
                                                            <GeometryDrawing Brush="LightGray">
                                                                <GeometryDrawing.Geometry>
                                                                    <GeometryGroup>
                                                                        <RectangleGeometry Rect="0,0,50,50"/>
                                                                        <RectangleGeometry Rect="50,50,50,50"/>
                                                                    </GeometryGroup>
                                                                </GeometryDrawing.Geometry>
                                                            </GeometryDrawing>
                                                        </DrawingGroup>
                                                    </DrawingBrush.Drawing>
                                                </DrawingBrush>
                                            </Border.Background>
                                            <Rectangle x:Name="SelectedColor">
                                                <Rectangle.Fill>
                                                    <Binding Path="SelectedColor" RelativeSource="{RelativeSource TemplatedParent}">
                                                        <Binding.Converter>
                                                            <Xceed_Wpf_Toolkit_Core_Converters:ColorToSolidColorBrushConverter/>
                                                        </Binding.Converter>
                                                    </Binding>
                                                </Rectangle.Fill>
                                            </Rectangle>
                                        </Border>
                                        <TextBox Grid.Column="1" Margin="2,0" Text="{Binding HexadecimalString, RelativeSource={RelativeSource TemplatedParent}}" VerticalAlignment="Center">
                                            <TextBox.Style>
                                                <Style TargetType="{x:Type TextBox}">
                                                    <Setter Property="Background" Value="Transparent"/>
                                                    <Style.BasedOn>
                                                        <Style TargetType="{x:Type TextBox}">
                                                            <Style.BasedOn>
                                                                <Style TargetType="{x:Type TextBoxBase}">
                                                                    <Setter Property="Foreground" Value="{DynamicResource {x:Static SystemColors.ControlTextBrushKey}}"/>
                                                                    <Setter Property="Background" Value="{DynamicResource {x:Static SystemColors.WindowBrushKey}}"/>
                                                                    <Setter Property="BorderBrush">
                                                                        <Setter.Value>
                                                                            <LinearGradientBrush EndPoint="0,20" MappingMode="Absolute" StartPoint="0,0">
                                                                                <GradientStop Color="#FFABADB3" Offset="0.05"/>
                                                                                <GradientStop Color="#FFE2E3EA" Offset="0.07"/>
                                                                                <GradientStop Color="#FFE3E9EF" Offset="1"/>
                                                                            </LinearGradientBrush>
                                                                        </Setter.Value>
                                                                    </Setter>
                                                                    <Setter Property="BorderThickness" Value="1"/>
                                                                    <Setter Property="Padding" Value="1"/>
                                                                    <Setter Property="AllowDrop" Value="True"/>
                                                                    <Setter Property="FocusVisualStyle" Value="{x:Null}"/>
                                                                    <Setter Property="Stylus.IsFlicksEnabled" Value="False"/>
                                                                    <Setter Property="Template">
                                                                        <Setter.Value>
                                                                            <ControlTemplate TargetType="{x:Type TextBoxBase}">
                                                                                <Microsoft_Windows_Themes:ListBoxChrome x:Name="Bd" BorderBrush="{TemplateBinding BorderBrush}" BorderThickness="{TemplateBinding BorderThickness}" Background="{TemplateBinding Background}" RenderMouseOver="{TemplateBinding IsMouseOver}" RenderFocused="{TemplateBinding IsKeyboardFocusWithin}" SnapsToDevicePixels="True">
                                                                                    <ScrollViewer x:Name="PART_ContentHost" SnapsToDevicePixels="{TemplateBinding SnapsToDevicePixels}"/>
                                                                                </Microsoft_Windows_Themes:ListBoxChrome>
                                                                                <ControlTemplate.Triggers>
                                                                                    <Trigger Property="IsEnabled" Value="False">
                                                                                        <Setter Property="Background" TargetName="Bd" Value="{DynamicResource {x:Static SystemColors.ControlBrushKey}}"/>
                                                                                        <Setter Property="Foreground" Value="{DynamicResource {x:Static SystemColors.GrayTextBrushKey}}"/>
                                                                                    </Trigger>
                                                                                </ControlTemplate.Triggers>
                                                                            </ControlTemplate>
                                                                        </Setter.Value>
                                                                    </Setter>
                                                                </Style>
                                                            </Style.BasedOn>
                                                        </Style>
                                                    </Style.BasedOn>
                                                    <Style.Triggers>
                                                        <Trigger Property="IsFocused" Value="False">
                                                            <Setter Property="BorderBrush" Value="Transparent"/>
                                                        </Trigger>
                                                    </Style.Triggers>
                                                </Style>
                                            </TextBox.Style>
                                        </TextBox>
                                    </Grid>
                                </Border>
                                <Border ClipToBounds="False" Grid.Column="1" Margin="4,-8,0,0" Grid.RowSpan="2">
                                    <xctk:ColorSpectrumSlider x:Name="PART_SpectrumSlider" SelectedColor="#FFFF0004" VerticalAlignment="Stretch"/>
                                </Border>
                            </Grid>
                            <Border BorderThickness="1" ClipToBounds="True" Margin="10,10,0,0" MinWidth="180" Grid.Column="1">
                                <Grid>
                                    <Grid.ColumnDefinitions>
                                        <ColumnDefinition Width="Auto"/>
                                        <ColumnDefinition Width="*"/>
                                        <ColumnDefinition Width="Auto"/>
                                    </Grid.ColumnDefinitions>
                                    <Grid.RowDefinitions>
                                        <RowDefinition Height="Auto"/>
                                        <RowDefinition Height="Auto"/>
                                        <RowDefinition Height="Auto"/>
                                        <RowDefinition Height="Auto"/>
                                    </Grid.RowDefinitions>
                                    <TextBlock Grid.Column="0" Grid.Row="0" Text="R" VerticalAlignment="Center"/>
                                    <Slider x:Name="PART_RSlider" Grid.Column="1" Maximum="255" Margin="4,6" Grid.Row="0" TickFrequency="1" Value="{Binding R, RelativeSource={RelativeSource TemplatedParent}}" VerticalAlignment="Center">
                                        <Slider.Style>
                                            <Style TargetType="{x:Type Slider}">
                                                <Setter Property="Template">
                                                    <Setter.Value>
                                                        <ControlTemplate TargetType="{x:Type Slider}">
                                                            <Border BorderBrush="{TemplateBinding BorderBrush}" BorderThickness="{TemplateBinding BorderThickness}" Background="{TemplateBinding Background}" SnapsToDevicePixels="True">
                                                                <Grid>
                                                                    <Grid.RowDefinitions>
                                                                        <RowDefinition Height="Auto"/>
                                                                        <RowDefinition Height="Auto" MinHeight="{TemplateBinding MinHeight}"/>
                                                                        <RowDefinition Height="Auto"/>
                                                                    </Grid.RowDefinitions>
                                                                    <TickBar x:Name="TopTick" Fill="{TemplateBinding Foreground}" Height="4" Placement="Top" Grid.Row="0" Visibility="Collapsed"/>
                                                                    <TickBar x:Name="BottomTick" Fill="{TemplateBinding Foreground}" Height="4" Placement="Bottom" Grid.Row="2" Visibility="Collapsed"/>
                                                                    <Border x:Name="TrackBackground" BorderThickness="1" Background="#FFE7EAEA" CornerRadius="1" Height="4" Margin="5,0" Grid.Row="1" VerticalAlignment="Center">
                                                                        <Border.BorderBrush>
                                                                            <LinearGradientBrush EndPoint="0,1" StartPoint="0,0">
                                                                                <GradientStop Color="#FFAEB1AF" Offset="0.1"/>
                                                                                <GradientStop Color="White" Offset="0.9"/>
                                                                            </LinearGradientBrush>
                                                                        </Border.BorderBrush>
                                                                        <Canvas Margin="-6,-1">
                                                                            <Rectangle x:Name="PART_SelectionRange" Fill="{DynamicResource {x:Static SystemColors.HighlightBrushKey}}" Height="4" Stroke="{DynamicResource {x:Static SystemColors.ControlDarkDarkBrushKey}}" StrokeThickness="1" Visibility="Hidden"/>
                                                                        </Canvas>
                                                                    </Border>
                                                                    <Track x:Name="PART_Track" Grid.Row="1">
                                                                        <Track.DecreaseRepeatButton>
                                                                            <RepeatButton Command="Slider.DecreaseLarge">
                                                                                <RepeatButton.Style>
                                                                                    <Style TargetType="{x:Type RepeatButton}">
                                                                                        <Setter Property="OverridesDefaultStyle" Value="True"/>
                                                                                        <Setter Property="IsTabStop" Value="False"/>
                                                                                        <Setter Property="Focusable" Value="False"/>
                                                                                        <Setter Property="Background" Value="Transparent"/>
                                                                                        <Setter Property="Template">
                                                                                            <Setter.Value>
                                                                                                <ControlTemplate TargetType="{x:Type RepeatButton}">
                                                                                                    <Border Background="{TemplateBinding Background}"/>
                                                                                                </ControlTemplate>
                                                                                            </Setter.Value>
                                                                                        </Setter>
                                                                                    </Style>
                                                                                </RepeatButton.Style>
                                                                            </RepeatButton>
                                                                        </Track.DecreaseRepeatButton>
                                                                        <Track.IncreaseRepeatButton>
                                                                            <RepeatButton Command="Slider.IncreaseLarge">
                                                                                <RepeatButton.Style>
                                                                                    <Style TargetType="{x:Type RepeatButton}">
                                                                                        <Setter Property="OverridesDefaultStyle" Value="True"/>
                                                                                        <Setter Property="IsTabStop" Value="False"/>
                                                                                        <Setter Property="Focusable" Value="False"/>
                                                                                        <Setter Property="Background" Value="Transparent"/>
                                                                                        <Setter Property="Template">
                                                                                            <Setter.Value>
                                                                                                <ControlTemplate TargetType="{x:Type RepeatButton}">
                                                                                                    <Border Background="{TemplateBinding Background}"/>
                                                                                                </ControlTemplate>
                                                                                            </Setter.Value>
                                                                                        </Setter>
                                                                                    </Style>
                                                                                </RepeatButton.Style>
                                                                            </RepeatButton>
                                                                        </Track.IncreaseRepeatButton>
                                                                        <Track.Thumb>
                                                                            <Thumb x:Name="Thumb">
                                                                                <Thumb.Style>
                                                                                    <Style TargetType="{x:Type Thumb}">
                                                                                        <Setter Property="OverridesDefaultStyle" Value="True"/>
                                                                                        <Setter Property="Template">
                                                                                            <Setter.Value>
                                                                                                <ControlTemplate TargetType="{x:Type Thumb}">
                                                                                                    <Rectangle x:Name="_thumb" Height="14" RadiusY="1" RadiusX="1" Width="8">
                                                                                                        <Rectangle.Fill>
                                                                                                            <LinearGradientBrush EndPoint="0,1" StartPoint="0,0">
                                                                                                                <GradientStop Color="#FFFEFEFE" Offset="0"/>
                                                                                                                <GradientStop Color="#FFEFF1F2" Offset="0.5"/>
                                                                                                                <GradientStop Color="#FFD0D6DB" Offset="1"/>
                                                                                                            </LinearGradientBrush>
                                                                                                        </Rectangle.Fill>
                                                                                                        <Rectangle.Stroke>
                                                                                                            <LinearGradientBrush EndPoint="0.5,1" StartPoint="0.5,0">
                                                                                                                <GradientStop Color="#FFA3AEB9" Offset="0"/>
                                                                                                                <GradientStop Color="#FF8399A9" Offset="0.375"/>
                                                                                                                <GradientStop Color="#FF718597" Offset="0.375"/>
                                                                                                                <GradientStop Color="#FF617584" Offset="1"/>
                                                                                                            </LinearGradientBrush>
                                                                                                        </Rectangle.Stroke>
                                                                                                    </Rectangle>
                                                                                                    <ControlTemplate.Triggers>
                                                                                                        <Trigger Property="IsMouseOver" Value="True">
                                                                                                            <Setter Property="Fill" TargetName="_thumb" Value="#FFE5F2F6"/>
                                                                                                        </Trigger>
                                                                                                    </ControlTemplate.Triggers>
                                                                                                </ControlTemplate>
                                                                                            </Setter.Value>
                                                                                        </Setter>
                                                                                    </Style>
                                                                                </Thumb.Style>
                                                                            </Thumb>
                                                                        </Track.Thumb>
                                                                    </Track>
                                                                </Grid>
                                                            </Border>
                                                        </ControlTemplate>
                                                    </Setter.Value>
                                                </Setter>
                                            </Style>
                                        </Slider.Style>
                                    </Slider>
                                    <TextBox Grid.Column="2" Grid.Row="0" Text="{Binding Value, ElementName=PART_RSlider}" VerticalAlignment="Center">
                                        <TextBox.Style>
                                            <Style TargetType="{x:Type TextBox}">
                                                <Setter Property="Background" Value="Transparent"/>
                                                <Style.BasedOn>
                                                    <Style TargetType="{x:Type TextBox}">
                                                        <Style.BasedOn>
                                                            <Style TargetType="{x:Type TextBoxBase}">
                                                                <Setter Property="Foreground" Value="{DynamicResource {x:Static SystemColors.ControlTextBrushKey}}"/>
                                                                <Setter Property="Background" Value="{DynamicResource {x:Static SystemColors.WindowBrushKey}}"/>
                                                                <Setter Property="BorderBrush">
                                                                    <Setter.Value>
                                                                        <LinearGradientBrush EndPoint="0,20" MappingMode="Absolute" StartPoint="0,0">
                                                                            <GradientStop Color="#FFABADB3" Offset="0.05"/>
                                                                            <GradientStop Color="#FFE2E3EA" Offset="0.07"/>
                                                                            <GradientStop Color="#FFE3E9EF" Offset="1"/>
                                                                        </LinearGradientBrush>
                                                                    </Setter.Value>
                                                                </Setter>
                                                                <Setter Property="BorderThickness" Value="1"/>
                                                                <Setter Property="Padding" Value="1"/>
                                                                <Setter Property="AllowDrop" Value="True"/>
                                                                <Setter Property="FocusVisualStyle" Value="{x:Null}"/>
                                                                <Setter Property="Stylus.IsFlicksEnabled" Value="False"/>
                                                                <Setter Property="Template">
                                                                    <Setter.Value>
                                                                        <ControlTemplate TargetType="{x:Type TextBoxBase}">
                                                                            <Microsoft_Windows_Themes:ListBoxChrome x:Name="Bd" BorderBrush="{TemplateBinding BorderBrush}" BorderThickness="{TemplateBinding BorderThickness}" Background="{TemplateBinding Background}" RenderMouseOver="{TemplateBinding IsMouseOver}" RenderFocused="{TemplateBinding IsKeyboardFocusWithin}" SnapsToDevicePixels="True">
                                                                                <ScrollViewer x:Name="PART_ContentHost" SnapsToDevicePixels="{TemplateBinding SnapsToDevicePixels}"/>
                                                                            </Microsoft_Windows_Themes:ListBoxChrome>
                                                                            <ControlTemplate.Triggers>
                                                                                <Trigger Property="IsEnabled" Value="False">
                                                                                    <Setter Property="Background" TargetName="Bd" Value="{DynamicResource {x:Static SystemColors.ControlBrushKey}}"/>
                                                                                    <Setter Property="Foreground" Value="{DynamicResource {x:Static SystemColors.GrayTextBrushKey}}"/>
                                                                                </Trigger>
                                                                            </ControlTemplate.Triggers>
                                                                        </ControlTemplate>
                                                                    </Setter.Value>
                                                                </Setter>
                                                            </Style>
                                                        </Style.BasedOn>
                                                    </Style>
                                                </Style.BasedOn>
                                                <Style.Triggers>
                                                    <Trigger Property="IsFocused" Value="False">
                                                        <Setter Property="BorderBrush" Value="Transparent"/>
                                                    </Trigger>
                                                </Style.Triggers>
                                            </Style>
                                        </TextBox.Style>
                                    </TextBox>
                                    <TextBlock Grid.Column="0" Grid.Row="1" Text="G" VerticalAlignment="Center"/>
                                    <Slider x:Name="PART_GSlider" Grid.Column="1" Maximum="255" Margin="4,6" Grid.Row="1" TickFrequency="1" Value="{Binding G, RelativeSource={RelativeSource TemplatedParent}}" VerticalAlignment="Center">
                                        <Slider.Style>
                                            <Style TargetType="{x:Type Slider}">
                                                <Setter Property="Template">
                                                    <Setter.Value>
                                                        <ControlTemplate TargetType="{x:Type Slider}">
                                                            <Border BorderBrush="{TemplateBinding BorderBrush}" BorderThickness="{TemplateBinding BorderThickness}" Background="{TemplateBinding Background}" SnapsToDevicePixels="True">
                                                                <Grid>
                                                                    <Grid.RowDefinitions>
                                                                        <RowDefinition Height="Auto"/>
                                                                        <RowDefinition Height="Auto" MinHeight="{TemplateBinding MinHeight}"/>
                                                                        <RowDefinition Height="Auto"/>
                                                                    </Grid.RowDefinitions>
                                                                    <TickBar x:Name="TopTick" Fill="{TemplateBinding Foreground}" Height="4" Placement="Top" Grid.Row="0" Visibility="Collapsed"/>
                                                                    <TickBar x:Name="BottomTick" Fill="{TemplateBinding Foreground}" Height="4" Placement="Bottom" Grid.Row="2" Visibility="Collapsed"/>
                                                                    <Border x:Name="TrackBackground" BorderThickness="1" Background="#FFE7EAEA" CornerRadius="1" Height="4" Margin="5,0" Grid.Row="1" VerticalAlignment="Center">
                                                                        <Border.BorderBrush>
                                                                            <LinearGradientBrush EndPoint="0,1" StartPoint="0,0">
                                                                                <GradientStop Color="#FFAEB1AF" Offset="0.1"/>
                                                                                <GradientStop Color="White" Offset="0.9"/>
                                                                            </LinearGradientBrush>
                                                                        </Border.BorderBrush>
                                                                        <Canvas Margin="-6,-1">
                                                                            <Rectangle x:Name="PART_SelectionRange" Fill="{DynamicResource {x:Static SystemColors.HighlightBrushKey}}" Height="4" Stroke="{DynamicResource {x:Static SystemColors.ControlDarkDarkBrushKey}}" StrokeThickness="1" Visibility="Hidden"/>
                                                                        </Canvas>
                                                                    </Border>
                                                                    <Track x:Name="PART_Track" Grid.Row="1">
                                                                        <Track.DecreaseRepeatButton>
                                                                            <RepeatButton Command="Slider.DecreaseLarge">
                                                                                <RepeatButton.Style>
                                                                                    <Style TargetType="{x:Type RepeatButton}">
                                                                                        <Setter Property="OverridesDefaultStyle" Value="True"/>
                                                                                        <Setter Property="IsTabStop" Value="False"/>
                                                                                        <Setter Property="Focusable" Value="False"/>
                                                                                        <Setter Property="Background" Value="Transparent"/>
                                                                                        <Setter Property="Template">
                                                                                            <Setter.Value>
                                                                                                <ControlTemplate TargetType="{x:Type RepeatButton}">
                                                                                                    <Border Background="{TemplateBinding Background}"/>
                                                                                                </ControlTemplate>
                                                                                            </Setter.Value>
                                                                                        </Setter>
                                                                                    </Style>
                                                                                </RepeatButton.Style>
                                                                            </RepeatButton>
                                                                        </Track.DecreaseRepeatButton>
                                                                        <Track.IncreaseRepeatButton>
                                                                            <RepeatButton Command="Slider.IncreaseLarge">
                                                                                <RepeatButton.Style>
                                                                                    <Style TargetType="{x:Type RepeatButton}">
                                                                                        <Setter Property="OverridesDefaultStyle" Value="True"/>
                                                                                        <Setter Property="IsTabStop" Value="False"/>
                                                                                        <Setter Property="Focusable" Value="False"/>
                                                                                        <Setter Property="Background" Value="Transparent"/>
                                                                                        <Setter Property="Template">
                                                                                            <Setter.Value>
                                                                                                <ControlTemplate TargetType="{x:Type RepeatButton}">
                                                                                                    <Border Background="{TemplateBinding Background}"/>
                                                                                                </ControlTemplate>
                                                                                            </Setter.Value>
                                                                                        </Setter>
                                                                                    </Style>
                                                                                </RepeatButton.Style>
                                                                            </RepeatButton>
                                                                        </Track.IncreaseRepeatButton>
                                                                        <Track.Thumb>
                                                                            <Thumb x:Name="Thumb">
                                                                                <Thumb.Style>
                                                                                    <Style TargetType="{x:Type Thumb}">
                                                                                        <Setter Property="OverridesDefaultStyle" Value="True"/>
                                                                                        <Setter Property="Template">
                                                                                            <Setter.Value>
                                                                                                <ControlTemplate TargetType="{x:Type Thumb}">
                                                                                                    <Rectangle x:Name="_thumb" Height="14" RadiusY="1" RadiusX="1" Width="8">
                                                                                                        <Rectangle.Fill>
                                                                                                            <LinearGradientBrush EndPoint="0,1" StartPoint="0,0">
                                                                                                                <GradientStop Color="#FFFEFEFE" Offset="0"/>
                                                                                                                <GradientStop Color="#FFEFF1F2" Offset="0.5"/>
                                                                                                                <GradientStop Color="#FFD0D6DB" Offset="1"/>
                                                                                                            </LinearGradientBrush>
                                                                                                        </Rectangle.Fill>
                                                                                                        <Rectangle.Stroke>
                                                                                                            <LinearGradientBrush EndPoint="0.5,1" StartPoint="0.5,0">
                                                                                                                <GradientStop Color="#FFA3AEB9" Offset="0"/>
                                                                                                                <GradientStop Color="#FF8399A9" Offset="0.375"/>
                                                                                                                <GradientStop Color="#FF718597" Offset="0.375"/>
                                                                                                                <GradientStop Color="#FF617584" Offset="1"/>
                                                                                                            </LinearGradientBrush>
                                                                                                        </Rectangle.Stroke>
                                                                                                    </Rectangle>
                                                                                                    <ControlTemplate.Triggers>
                                                                                                        <Trigger Property="IsMouseOver" Value="True">
                                                                                                            <Setter Property="Fill" TargetName="_thumb" Value="#FFE5F2F6"/>
                                                                                                        </Trigger>
                                                                                                    </ControlTemplate.Triggers>
                                                                                                </ControlTemplate>
                                                                                            </Setter.Value>
                                                                                        </Setter>
                                                                                    </Style>
                                                                                </Thumb.Style>
                                                                            </Thumb>
                                                                        </Track.Thumb>
                                                                    </Track>
                                                                </Grid>
                                                            </Border>
                                                        </ControlTemplate>
                                                    </Setter.Value>
                                                </Setter>
                                            </Style>
                                        </Slider.Style>
                                    </Slider>
                                    <TextBox Grid.Column="2" Grid.Row="1" Text="{Binding Value, ElementName=PART_GSlider}" VerticalAlignment="Center">
                                        <TextBox.Style>
                                            <Style TargetType="{x:Type TextBox}">
                                                <Setter Property="Background" Value="Transparent"/>
                                                <Style.BasedOn>
                                                    <Style TargetType="{x:Type TextBox}">
                                                        <Style.BasedOn>
                                                            <Style TargetType="{x:Type TextBoxBase}">
                                                                <Setter Property="Foreground" Value="{DynamicResource {x:Static SystemColors.ControlTextBrushKey}}"/>
                                                                <Setter Property="Background" Value="{DynamicResource {x:Static SystemColors.WindowBrushKey}}"/>
                                                                <Setter Property="BorderBrush">
                                                                    <Setter.Value>
                                                                        <LinearGradientBrush EndPoint="0,20" MappingMode="Absolute" StartPoint="0,0">
                                                                            <GradientStop Color="#FFABADB3" Offset="0.05"/>
                                                                            <GradientStop Color="#FFE2E3EA" Offset="0.07"/>
                                                                            <GradientStop Color="#FFE3E9EF" Offset="1"/>
                                                                        </LinearGradientBrush>
                                                                    </Setter.Value>
                                                                </Setter>
                                                                <Setter Property="BorderThickness" Value="1"/>
                                                                <Setter Property="Padding" Value="1"/>
                                                                <Setter Property="AllowDrop" Value="True"/>
                                                                <Setter Property="FocusVisualStyle" Value="{x:Null}"/>
                                                                <Setter Property="Stylus.IsFlicksEnabled" Value="False"/>
                                                                <Setter Property="Template">
                                                                    <Setter.Value>
                                                                        <ControlTemplate TargetType="{x:Type TextBoxBase}">
                                                                            <Microsoft_Windows_Themes:ListBoxChrome x:Name="Bd" BorderBrush="{TemplateBinding BorderBrush}" BorderThickness="{TemplateBinding BorderThickness}" Background="{TemplateBinding Background}" RenderMouseOver="{TemplateBinding IsMouseOver}" RenderFocused="{TemplateBinding IsKeyboardFocusWithin}" SnapsToDevicePixels="True">
                                                                                <ScrollViewer x:Name="PART_ContentHost" SnapsToDevicePixels="{TemplateBinding SnapsToDevicePixels}"/>
                                                                            </Microsoft_Windows_Themes:ListBoxChrome>
                                                                            <ControlTemplate.Triggers>
                                                                                <Trigger Property="IsEnabled" Value="False">
                                                                                    <Setter Property="Background" TargetName="Bd" Value="{DynamicResource {x:Static SystemColors.ControlBrushKey}}"/>
                                                                                    <Setter Property="Foreground" Value="{DynamicResource {x:Static SystemColors.GrayTextBrushKey}}"/>
                                                                                </Trigger>
                                                                            </ControlTemplate.Triggers>
                                                                        </ControlTemplate>
                                                                    </Setter.Value>
                                                                </Setter>
                                                            </Style>
                                                        </Style.BasedOn>
                                                    </Style>
                                                </Style.BasedOn>
                                                <Style.Triggers>
                                                    <Trigger Property="IsFocused" Value="False">
                                                        <Setter Property="BorderBrush" Value="Transparent"/>
                                                    </Trigger>
                                                </Style.Triggers>
                                            </Style>
                                        </TextBox.Style>
                                    </TextBox>
                                    <TextBlock Grid.Column="0" Grid.Row="2" Text="B" VerticalAlignment="Center"/>
                                    <Slider x:Name="PART_BSlider" Grid.Column="1" Maximum="255" Margin="4,6" Grid.Row="2" TickFrequency="1" Value="{Binding B, RelativeSource={RelativeSource TemplatedParent}}" VerticalAlignment="Center">
                                        <Slider.Style>
                                            <Style TargetType="{x:Type Slider}">
                                                <Setter Property="Template">
                                                    <Setter.Value>
                                                        <ControlTemplate TargetType="{x:Type Slider}">
                                                            <Border BorderBrush="{TemplateBinding BorderBrush}" BorderThickness="{TemplateBinding BorderThickness}" Background="{TemplateBinding Background}" SnapsToDevicePixels="True">
                                                                <Grid>
                                                                    <Grid.RowDefinitions>
                                                                        <RowDefinition Height="Auto"/>
                                                                        <RowDefinition Height="Auto" MinHeight="{TemplateBinding MinHeight}"/>
                                                                        <RowDefinition Height="Auto"/>
                                                                    </Grid.RowDefinitions>
                                                                    <TickBar x:Name="TopTick" Fill="{TemplateBinding Foreground}" Height="4" Placement="Top" Grid.Row="0" Visibility="Collapsed"/>
                                                                    <TickBar x:Name="BottomTick" Fill="{TemplateBinding Foreground}" Height="4" Placement="Bottom" Grid.Row="2" Visibility="Collapsed"/>
                                                                    <Border x:Name="TrackBackground" BorderThickness="1" Background="#FFE7EAEA" CornerRadius="1" Height="4" Margin="5,0" Grid.Row="1" VerticalAlignment="Center">
                                                                        <Border.BorderBrush>
                                                                            <LinearGradientBrush EndPoint="0,1" StartPoint="0,0">
                                                                                <GradientStop Color="#FFAEB1AF" Offset="0.1"/>
                                                                                <GradientStop Color="White" Offset="0.9"/>
                                                                            </LinearGradientBrush>
                                                                        </Border.BorderBrush>
                                                                        <Canvas Margin="-6,-1">
                                                                            <Rectangle x:Name="PART_SelectionRange" Fill="{DynamicResource {x:Static SystemColors.HighlightBrushKey}}" Height="4" Stroke="{DynamicResource {x:Static SystemColors.ControlDarkDarkBrushKey}}" StrokeThickness="1" Visibility="Hidden"/>
                                                                        </Canvas>
                                                                    </Border>
                                                                    <Track x:Name="PART_Track" Grid.Row="1">
                                                                        <Track.DecreaseRepeatButton>
                                                                            <RepeatButton Command="Slider.DecreaseLarge">
                                                                                <RepeatButton.Style>
                                                                                    <Style TargetType="{x:Type RepeatButton}">
                                                                                        <Setter Property="OverridesDefaultStyle" Value="True"/>
                                                                                        <Setter Property="IsTabStop" Value="False"/>
                                                                                        <Setter Property="Focusable" Value="False"/>
                                                                                        <Setter Property="Background" Value="Transparent"/>
                                                                                        <Setter Property="Template">
                                                                                            <Setter.Value>
                                                                                                <ControlTemplate TargetType="{x:Type RepeatButton}">
                                                                                                    <Border Background="{TemplateBinding Background}"/>
                                                                                                </ControlTemplate>
                                                                                            </Setter.Value>
                                                                                        </Setter>
                                                                                    </Style>
                                                                                </RepeatButton.Style>
                                                                            </RepeatButton>
                                                                        </Track.DecreaseRepeatButton>
                                                                        <Track.IncreaseRepeatButton>
                                                                            <RepeatButton Command="Slider.IncreaseLarge">
                                                                                <RepeatButton.Style>
                                                                                    <Style TargetType="{x:Type RepeatButton}">
                                                                                        <Setter Property="OverridesDefaultStyle" Value="True"/>
                                                                                        <Setter Property="IsTabStop" Value="False"/>
                                                                                        <Setter Property="Focusable" Value="False"/>
                                                                                        <Setter Property="Background" Value="Transparent"/>
                                                                                        <Setter Property="Template">
                                                                                            <Setter.Value>
                                                                                                <ControlTemplate TargetType="{x:Type RepeatButton}">
                                                                                                    <Border Background="{TemplateBinding Background}"/>
                                                                                                </ControlTemplate>
                                                                                            </Setter.Value>
                                                                                        </Setter>
                                                                                    </Style>
                                                                                </RepeatButton.Style>
                                                                            </RepeatButton>
                                                                        </Track.IncreaseRepeatButton>
                                                                        <Track.Thumb>
                                                                            <Thumb x:Name="Thumb">
                                                                                <Thumb.Style>
                                                                                    <Style TargetType="{x:Type Thumb}">
                                                                                        <Setter Property="OverridesDefaultStyle" Value="True"/>
                                                                                        <Setter Property="Template">
                                                                                            <Setter.Value>
                                                                                                <ControlTemplate TargetType="{x:Type Thumb}">
                                                                                                    <Rectangle x:Name="_thumb" Height="14" RadiusY="1" RadiusX="1" Width="8">
                                                                                                        <Rectangle.Fill>
                                                                                                            <LinearGradientBrush EndPoint="0,1" StartPoint="0,0">
                                                                                                                <GradientStop Color="#FFFEFEFE" Offset="0"/>
                                                                                                                <GradientStop Color="#FFEFF1F2" Offset="0.5"/>
                                                                                                                <GradientStop Color="#FFD0D6DB" Offset="1"/>
                                                                                                            </LinearGradientBrush>
                                                                                                        </Rectangle.Fill>
                                                                                                        <Rectangle.Stroke>
                                                                                                            <LinearGradientBrush EndPoint="0.5,1" StartPoint="0.5,0">
                                                                                                                <GradientStop Color="#FFA3AEB9" Offset="0"/>
                                                                                                                <GradientStop Color="#FF8399A9" Offset="0.375"/>
                                                                                                                <GradientStop Color="#FF718597" Offset="0.375"/>
                                                                                                                <GradientStop Color="#FF617584" Offset="1"/>
                                                                                                            </LinearGradientBrush>
                                                                                                        </Rectangle.Stroke>
                                                                                                    </Rectangle>
                                                                                                    <ControlTemplate.Triggers>
                                                                                                        <Trigger Property="IsMouseOver" Value="True">
                                                                                                            <Setter Property="Fill" TargetName="_thumb" Value="#FFE5F2F6"/>
                                                                                                        </Trigger>
                                                                                                    </ControlTemplate.Triggers>
                                                                                                </ControlTemplate>
                                                                                            </Setter.Value>
                                                                                        </Setter>
                                                                                    </Style>
                                                                                </Thumb.Style>
                                                                            </Thumb>
                                                                        </Track.Thumb>
                                                                    </Track>
                                                                </Grid>
                                                            </Border>
                                                        </ControlTemplate>
                                                    </Setter.Value>
                                                </Setter>
                                            </Style>
                                        </Slider.Style>
                                    </Slider>
                                    <TextBox Grid.Column="3" Grid.Row="2" Text="{Binding Value, ElementName=PART_BSlider}" VerticalAlignment="Center">
                                        <TextBox.Style>
                                            <Style TargetType="{x:Type TextBox}">
                                                <Setter Property="Background" Value="Transparent"/>
                                                <Style.BasedOn>
                                                    <Style TargetType="{x:Type TextBox}">
                                                        <Style.BasedOn>
                                                            <Style TargetType="{x:Type TextBoxBase}">
                                                                <Setter Property="Foreground" Value="{DynamicResource {x:Static SystemColors.ControlTextBrushKey}}"/>
                                                                <Setter Property="Background" Value="{DynamicResource {x:Static SystemColors.WindowBrushKey}}"/>
                                                                <Setter Property="BorderBrush">
                                                                    <Setter.Value>
                                                                        <LinearGradientBrush EndPoint="0,20" MappingMode="Absolute" StartPoint="0,0">
                                                                            <GradientStop Color="#FFABADB3" Offset="0.05"/>
                                                                            <GradientStop Color="#FFE2E3EA" Offset="0.07"/>
                                                                            <GradientStop Color="#FFE3E9EF" Offset="1"/>
                                                                        </LinearGradientBrush>
                                                                    </Setter.Value>
                                                                </Setter>
                                                                <Setter Property="BorderThickness" Value="1"/>
                                                                <Setter Property="Padding" Value="1"/>
                                                                <Setter Property="AllowDrop" Value="True"/>
                                                                <Setter Property="FocusVisualStyle" Value="{x:Null}"/>
                                                                <Setter Property="Stylus.IsFlicksEnabled" Value="False"/>
                                                                <Setter Property="Template">
                                                                    <Setter.Value>
                                                                        <ControlTemplate TargetType="{x:Type TextBoxBase}">
                                                                            <Microsoft_Windows_Themes:ListBoxChrome x:Name="Bd" BorderBrush="{TemplateBinding BorderBrush}" BorderThickness="{TemplateBinding BorderThickness}" Background="{TemplateBinding Background}" RenderMouseOver="{TemplateBinding IsMouseOver}" RenderFocused="{TemplateBinding IsKeyboardFocusWithin}" SnapsToDevicePixels="True">
                                                                                <ScrollViewer x:Name="PART_ContentHost" SnapsToDevicePixels="{TemplateBinding SnapsToDevicePixels}"/>
                                                                            </Microsoft_Windows_Themes:ListBoxChrome>
                                                                            <ControlTemplate.Triggers>
                                                                                <Trigger Property="IsEnabled" Value="False">
                                                                                    <Setter Property="Background" TargetName="Bd" Value="{DynamicResource {x:Static SystemColors.ControlBrushKey}}"/>
                                                                                    <Setter Property="Foreground" Value="{DynamicResource {x:Static SystemColors.GrayTextBrushKey}}"/>
                                                                                </Trigger>
                                                                            </ControlTemplate.Triggers>
                                                                        </ControlTemplate>
                                                                    </Setter.Value>
                                                                </Setter>
                                                            </Style>
                                                        </Style.BasedOn>
                                                    </Style>
                                                </Style.BasedOn>
                                                <Style.Triggers>
                                                    <Trigger Property="IsFocused" Value="False">
                                                        <Setter Property="BorderBrush" Value="Transparent"/>
                                                    </Trigger>
                                                </Style.Triggers>
                                            </Style>
                                        </TextBox.Style>
                                    </TextBox>
                                    <TextBlock Grid.Column="0" Grid.Row="3" Text="A" VerticalAlignment="Center"/>
                                    <Slider x:Name="PART_OpacitySlider" Grid.Column="1" Maximum="255" Margin="4,6" Grid.Row="3" Value="{Binding A, RelativeSource={RelativeSource TemplatedParent}}" VerticalAlignment="Center">
                                        <Slider.Style>
                                            <Style TargetType="{x:Type Slider}">
                                                <Setter Property="Template">
                                                    <Setter.Value>
                                                        <ControlTemplate TargetType="{x:Type Slider}">
                                                            <Border BorderBrush="{TemplateBinding BorderBrush}" BorderThickness="{TemplateBinding BorderThickness}" Background="{TemplateBinding Background}" SnapsToDevicePixels="True">
                                                                <Grid>
                                                                    <Grid.RowDefinitions>
                                                                        <RowDefinition Height="Auto"/>
                                                                        <RowDefinition Height="Auto" MinHeight="{TemplateBinding MinHeight}"/>
                                                                        <RowDefinition Height="Auto"/>
                                                                    </Grid.RowDefinitions>
                                                                    <TickBar x:Name="TopTick" Fill="{TemplateBinding Foreground}" Height="4" Placement="Top" Grid.Row="0" Visibility="Collapsed"/>
                                                                    <TickBar x:Name="BottomTick" Fill="{TemplateBinding Foreground}" Height="4" Placement="Bottom" Grid.Row="2" Visibility="Collapsed"/>
                                                                    <Border x:Name="TrackBackground" BorderThickness="1" Background="#FFE7EAEA" CornerRadius="1" Height="4" Margin="5,0" Grid.Row="1" VerticalAlignment="Center">
                                                                        <Border.BorderBrush>
                                                                            <LinearGradientBrush EndPoint="0,1" StartPoint="0,0">
                                                                                <GradientStop Color="#FFAEB1AF" Offset="0.1"/>
                                                                                <GradientStop Color="White" Offset="0.9"/>
                                                                            </LinearGradientBrush>
                                                                        </Border.BorderBrush>
                                                                        <Canvas Margin="-6,-1">
                                                                            <Rectangle x:Name="PART_SelectionRange" Fill="{DynamicResource {x:Static SystemColors.HighlightBrushKey}}" Height="4" Stroke="{DynamicResource {x:Static SystemColors.ControlDarkDarkBrushKey}}" StrokeThickness="1" Visibility="Hidden"/>
                                                                        </Canvas>
                                                                    </Border>
                                                                    <Track x:Name="PART_Track" Grid.Row="1">
                                                                        <Track.DecreaseRepeatButton>
                                                                            <RepeatButton Command="Slider.DecreaseLarge">
                                                                                <RepeatButton.Style>
                                                                                    <Style TargetType="{x:Type RepeatButton}">
                                                                                        <Setter Property="OverridesDefaultStyle" Value="True"/>
                                                                                        <Setter Property="IsTabStop" Value="False"/>
                                                                                        <Setter Property="Focusable" Value="False"/>
                                                                                        <Setter Property="Background" Value="Transparent"/>
                                                                                        <Setter Property="Template">
                                                                                            <Setter.Value>
                                                                                                <ControlTemplate TargetType="{x:Type RepeatButton}">
                                                                                                    <Border Background="{TemplateBinding Background}"/>
                                                                                                </ControlTemplate>
                                                                                            </Setter.Value>
                                                                                        </Setter>
                                                                                    </Style>
                                                                                </RepeatButton.Style>
                                                                            </RepeatButton>
                                                                        </Track.DecreaseRepeatButton>
                                                                        <Track.IncreaseRepeatButton>
                                                                            <RepeatButton Command="Slider.IncreaseLarge">
                                                                                <RepeatButton.Style>
                                                                                    <Style TargetType="{x:Type RepeatButton}">
                                                                                        <Setter Property="OverridesDefaultStyle" Value="True"/>
                                                                                        <Setter Property="IsTabStop" Value="False"/>
                                                                                        <Setter Property="Focusable" Value="False"/>
                                                                                        <Setter Property="Background" Value="Transparent"/>
                                                                                        <Setter Property="Template">
                                                                                            <Setter.Value>
                                                                                                <ControlTemplate TargetType="{x:Type RepeatButton}">
                                                                                                    <Border Background="{TemplateBinding Background}"/>
                                                                                                </ControlTemplate>
                                                                                            </Setter.Value>
                                                                                        </Setter>
                                                                                    </Style>
                                                                                </RepeatButton.Style>
                                                                            </RepeatButton>
                                                                        </Track.IncreaseRepeatButton>
                                                                        <Track.Thumb>
                                                                            <Thumb x:Name="Thumb">
                                                                                <Thumb.Style>
                                                                                    <Style TargetType="{x:Type Thumb}">
                                                                                        <Setter Property="OverridesDefaultStyle" Value="True"/>
                                                                                        <Setter Property="Template">
                                                                                            <Setter.Value>
                                                                                                <ControlTemplate TargetType="{x:Type Thumb}">
                                                                                                    <Rectangle x:Name="_thumb" Height="14" RadiusY="1" RadiusX="1" Width="8">
                                                                                                        <Rectangle.Fill>
                                                                                                            <LinearGradientBrush EndPoint="0,1" StartPoint="0,0">
                                                                                                                <GradientStop Color="#FFFEFEFE" Offset="0"/>
                                                                                                                <GradientStop Color="#FFEFF1F2" Offset="0.5"/>
                                                                                                                <GradientStop Color="#FFD0D6DB" Offset="1"/>
                                                                                                            </LinearGradientBrush>
                                                                                                        </Rectangle.Fill>
                                                                                                        <Rectangle.Stroke>
                                                                                                            <LinearGradientBrush EndPoint="0.5,1" StartPoint="0.5,0">
                                                                                                                <GradientStop Color="#FFA3AEB9" Offset="0"/>
                                                                                                                <GradientStop Color="#FF8399A9" Offset="0.375"/>
                                                                                                                <GradientStop Color="#FF718597" Offset="0.375"/>
                                                                                                                <GradientStop Color="#FF617584" Offset="1"/>
                                                                                                            </LinearGradientBrush>
                                                                                                        </Rectangle.Stroke>
                                                                                                    </Rectangle>
                                                                                                    <ControlTemplate.Triggers>
                                                                                                        <Trigger Property="IsMouseOver" Value="True">
                                                                                                            <Setter Property="Fill" TargetName="_thumb" Value="#FFE5F2F6"/>
                                                                                                        </Trigger>
                                                                                                    </ControlTemplate.Triggers>
                                                                                                </ControlTemplate>
                                                                                            </Setter.Value>
                                                                                        </Setter>
                                                                                    </Style>
                                                                                </Thumb.Style>
                                                                            </Thumb>
                                                                        </Track.Thumb>
                                                                    </Track>
                                                                </Grid>
                                                            </Border>
                                                        </ControlTemplate>
                                                    </Setter.Value>
                                                </Setter>
                                            </Style>
                                        </Slider.Style>
                                    </Slider>
                                    <TextBox Grid.Column="3" Grid.Row="3" Text="{Binding Value, ElementName=PART_OpacitySlider}" VerticalAlignment="Center">
                                        <TextBox.Style>
                                            <Style TargetType="{x:Type TextBox}">
                                                <Setter Property="Background" Value="Transparent"/>
                                                <Style.BasedOn>
                                                    <Style TargetType="{x:Type TextBox}">
                                                        <Style.BasedOn>
                                                            <Style TargetType="{x:Type TextBoxBase}">
                                                                <Setter Property="Foreground" Value="{DynamicResource {x:Static SystemColors.ControlTextBrushKey}}"/>
                                                                <Setter Property="Background" Value="{DynamicResource {x:Static SystemColors.WindowBrushKey}}"/>
                                                                <Setter Property="BorderBrush">
                                                                    <Setter.Value>
                                                                        <LinearGradientBrush EndPoint="0,20" MappingMode="Absolute" StartPoint="0,0">
                                                                            <GradientStop Color="#FFABADB3" Offset="0.05"/>
                                                                            <GradientStop Color="#FFE2E3EA" Offset="0.07"/>
                                                                            <GradientStop Color="#FFE3E9EF" Offset="1"/>
                                                                        </LinearGradientBrush>
                                                                    </Setter.Value>
                                                                </Setter>
                                                                <Setter Property="BorderThickness" Value="1"/>
                                                                <Setter Property="Padding" Value="1"/>
                                                                <Setter Property="AllowDrop" Value="True"/>
                                                                <Setter Property="FocusVisualStyle" Value="{x:Null}"/>
                                                                <Setter Property="Stylus.IsFlicksEnabled" Value="False"/>
                                                                <Setter Property="Template">
                                                                    <Setter.Value>
                                                                        <ControlTemplate TargetType="{x:Type TextBoxBase}">
                                                                            <Microsoft_Windows_Themes:ListBoxChrome x:Name="Bd" BorderBrush="{TemplateBinding BorderBrush}" BorderThickness="{TemplateBinding BorderThickness}" Background="{TemplateBinding Background}" RenderMouseOver="{TemplateBinding IsMouseOver}" RenderFocused="{TemplateBinding IsKeyboardFocusWithin}" SnapsToDevicePixels="True">
                                                                                <ScrollViewer x:Name="PART_ContentHost" SnapsToDevicePixels="{TemplateBinding SnapsToDevicePixels}"/>
                                                                            </Microsoft_Windows_Themes:ListBoxChrome>
                                                                            <ControlTemplate.Triggers>
                                                                                <Trigger Property="IsEnabled" Value="False">
                                                                                    <Setter Property="Background" TargetName="Bd" Value="{DynamicResource {x:Static SystemColors.ControlBrushKey}}"/>
                                                                                    <Setter Property="Foreground" Value="{DynamicResource {x:Static SystemColors.GrayTextBrushKey}}"/>
                                                                                </Trigger>
                                                                            </ControlTemplate.Triggers>
                                                                        </ControlTemplate>
                                                                    </Setter.Value>
                                                                </Setter>
                                                            </Style>
                                                        </Style.BasedOn>
                                                    </Style>
                                                </Style.BasedOn>
                                                <Style.Triggers>
                                                    <Trigger Property="IsFocused" Value="False">
                                                        <Setter Property="BorderBrush" Value="Transparent"/>
                                                    </Trigger>
                                                </Style.Triggers>
                                            </Style>
                                        </TextBox.Style>
                                    </TextBox>
                                </Grid>
                            </Border>
                        </Grid>
                    </Border>
                </ControlTemplate>
            </Setter.Value>
        </Setter>
    </Style>
</ResourceDictionary>
